#include "HndFToRawFThreadProc.h"
#include "HndFToRawF.h"
#include "HndToRawData.h"
#include <process.h>

uint __stdcall HndFToRawFThreadProc(void* param)
{
	HndFToRawFThreadProcParams* params = ((HndFToRawFThreadProcParams*)param);
	FILE* hndfile = params->hndfile;
	FILE* rawfile = params->rawfile;

	fseek(hndfile, 512 - 64, SEEK_SET);
	fread(&params->projAngles[params->fileId], sizeof(double), 1, hndfile);
	rewind(hndfile);

	HndFToRawF(hndfile, rawfile);
	fclose(hndfile);
	fclose(rawfile);

	InterlockedIncrement(((HndFToRawFThreadProcParams*)param)->doneCount);

	_endthreadex(0);
	return 0;
}